package com.example.serverdemo.util;

import com.example.serverdemo.constant.RSAConstant;

import java.util.Base64;

public class EncryptUtil {

    /**
     * @param string sText             AES加密的密文
     * @param string sRasEncryptedKey  经过RAS加密后的密文
     * @return string res              明文
     */
    public static String rsa_aes_decrypt(String sText, String sRasEncryptedKey) throws Exception {

        String key = null, res = null;
        key = RSACipher.decrypt(sRasEncryptedKey, RSAConstant.encSk);
        System.out.println(key);
        Base64.Decoder decoder = Base64.getDecoder();
        res = AESCipher.decrypt(decoder.decode(key), sText);
        return res;
    }

}
